home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / comm / bbs / cit_src_7H21.lha / nodedit.c < prev    next >
C/C++ Source or Header  |  1997-07-27  |  23KB  |  817 lines

  1. /*
  2. *       nodedit.c
  3. *
  4. * Networking List Editor.
  5. */
  6. #include "ctdl.h"
  7.  
  8. extern CONFIG    cfg;
  9. extern NetBuffer netTemp;
  10. extern logBuffer logBuf;  /* Person buffer    */
  11. extern logBuffer logTmp;  /* Person buffer    */
  12. extern aRoom     roomBuf; /* Room buffer      */
  13. extern rTable    *roomTab;
  14. extern MessageBuffer   msgBuf;
  15. extern MessageBuffer   tempMess;
  16. extern NetBuffer netBuf;
  17. extern NetTable  *netTab;
  18. extern int       thisNet;
  19. extern char      onConsole;
  20. extern char      loggedIn;  /* Is we logged in?   */
  21. extern char      outFlag; /* Output flag      */
  22. extern char      haveCarrier; /* Do we still got carrier?     */
  23. extern char      modStat; /* Needed so we don't die       */
  24. extern char      WCError;
  25. extern int       thisRoom;
  26. extern int       thisLog;
  27. extern char      *confirm;
  28. extern char      heldMess;
  29. extern char      netDebug;
  30. extern char      *AssignAddress;
  31. extern char      remoteSysop;
  32. extern char     *DomainFlags;
  33.  
  34. char    *SR_Sent;
  35. char    ErrBuf[100];    /* General buffer for error messages */
  36. FILE    *netLog, *netMisc, *netMsg;
  37. static char     UsedNetMsg;
  38. int   callSlot;
  39. label   normed, callerName, callerId;
  40. logBuffer       *lBuf;
  41. int   PriorityMail = 0;
  42. char    *pollCall;
  43. int   LD_Delay = 60;
  44.  
  45. int Request_String(char *string, char *buffer, int size);
  46.  
  47. void ExplainNeed(int i, MULTI_NET_DATA x);
  48. void freeUNS();
  49.  
  50. SListBase UntilNetSessions =
  51.   {
  52.   NULL, ChkTwoNumbers, NULL, freeUNS, NULL
  53.  
  54.   };
  55.  
  56.  
  57. int Request_String(char *string, char *buffer, int size)
  58.   {
  59.   /**
  60.     Description:  Prompt with "string", and get up to size
  61.     characters into buffer.
  62.     return TRUE if we got something, FALSE if not
  63.   **/
  64.   printf("\n%s",string);
  65.   buffer[0] = '\0';
  66.   fgets(buffer,size, fp);
  67.   return ( strlen(buffer) > 0 ? TRUE : FALSE );
  68.   }
  69.  
  70. /*
  71. * Main Menu Processing
  72. */
  73. void netStuff()
  74.   {
  75.   extern char *who_str;
  76.   extern char ForceNet;
  77.   TwoNumbers  tmp;
  78.   char  work[50];
  79.   label       who;
  80.   int   logNo;
  81.   long  Redials, duration;
  82.  
  83.   int flag;
  84.   printf(" Node Editor Version 1.0\n");
  85.   cfg.weAre = UTILITY;
  86.   if (!readSysTab(TRUE, TRUE))
  87.     {
  88.     printf("Unable to load CTDLTABL.SYS data\n");
  89.     exit(100);
  90.     };
  91.   cfg.weAre = UTILITY;
  92.  
  93.   if (!cfg.BoolFlags.netParticipant)
  94.     {
  95.     printf( "Networking is disabled on this installation.\n ");
  96.     printf( "You may not use this utility.\n");
  97.     exit(0);
  98.     };
  99.   mvToHomeDisk(&cfg.homeArea);
  100.  
  101.   /* process network information */
  102.   makeSysName(fn, "ctdlnet.sys", &cfg.netArea);
  103.   openFile(fn, &netfl);
  104.   initNetBuf(&netBuf);
  105.  
  106.   /* open room file */
  107.   sprintf(fn, "%sctdlroom.sys", &cfg.roomArea);
  108.   openFile(fn, &roomfl);
  109.  
  110.  
  111.   for(;;)   /* do forever */
  112.     {
  113.     printf(" A - Add a Node       E - Edit a Node     R - request a file\n");
  114.     printf(" L - List Local Nodes V - View Node List  N - Set Net Privileges \n");
  115.     printf(" S - Send a file      X - Exit            Option:");
  116.     switch ( getchar() )
  117.       {
  118.       case 'x':  /* Exit */
  119.       case 'X':
  120.         Save_System_Data();
  121.         printf("Data Saved, program exited\n");
  122.         exit(0);
  123.         break;
  124.       case 'R':   /* File requests */
  125.       case 'r':
  126.         Request_String("Enter System Name:", who, sizeof who);
  127.         if (!ReqNodeName(NULL, who, NULL, FALSE, FALSE, FALSE,FALSE, TRUE, &netBuf)) break;
  128.         fileRequest();
  129.         break;
  130.       case 'S':   /* File transmissions */
  131.       case 's':
  132.         Request_String("Enter System Name", who, sizeof who);
  133.         if (!ReqNodeName(NULL, who, NULL, FALSE, FALSE, FALSE,FALSE, TRUE, &netBuf))      break;
  134.         getSendFiles(id, who);
  135.         break;
  136.       case 'V':   /* View the net list. */
  137.       case 'v':
  138.         writeNet(TRUE, FALSE);
  139.         if (NeedSysopInpPrompt()) modIn();
  140.         break;
  141.       case 'L':  /* local only list
  142.       case 'l':
  143.         break;
  144.       case 'A':   /* Add a new node to the list */
  145.         addNetNode();
  146.         break;
  147.       case 'E':   /* Edit a node that is on the list */
  148.         Request_String("Enter Node Name", who, sizeof who);
  149.         if (ReqNodeName(NULL, who, NULL, FALSE, TRUE, FALSE, TRUE, TRUE, &netBuf)) editNode();
  150.         break;
  151.       }
  152.     };
  153.   }
  154.  
  155. static char AddedFiles;
  156. /**
  157.   Description;
  158.   This will get the files from the sysop to send to another system.
  159. **/
  160. void getSendFiles(MenuId id, label sysName)
  161.   {
  162.   /**
  163.     Description;
  164.     This will get the files from the sysop to send to another system.
  165.   **/
  166.   SYS_FILE       sysFile;
  167.   char     temp[10];
  168.   extern char    *APPEND_ANY;
  169.   char     *Files, list[126];
  170.   struct fl_send sendWhat;
  171.  
  172.   sPrintf(temp, "%d.sfl", thisNet);
  173.   makeSysName(sysFile, temp, &cfg.netArea);
  174.   if ((upfd = safeopen(sysFile, APPEND_ANY)) == NULL)
  175.     {
  176.     printf(id, "Couldn't open %s for update?\n ", sysFile);
  177.     return ;
  178.     };
  179.   printf("Files to send to %s:", sysName);
  180.   fgets(list, sizeof list, stdin);
  181.  
  182.   getList(addSendFile, msgBuf.mbtext, 126, TRUE);
  183.  
  184.   Files = strtok(list, " ");
  185.   if( Files )
  186.     {
  187. *****    sysGetSendFilesV2(, Files, &sendWhat))
  188. *****    putSLNet(sendWhat, upfd);
  189.     while( (Files = strtok(NULL, " ") ) != NULL )
  190.       {
  191.       if (sysGetSendFilesV2(GetListId, Files, &sendWhat))
  192.         {
  193.         putSLNet(sendWhat, upfd);
  194.         };
  195.       };
  196.     netBuf.nbflags.send_files = TRUE;
  197.     putNet(thisNet, &netBuf);
  198.     };
  199.   fclose(upfd);
  200.   }
  201.  
  202. /*
  203. * addSendFile()
  204. *
  205. * This is a work function, called indirectly by getList().
  206. */
  207. int addSendFile(char *Files)
  208.   {
  209.   struct fl_send sendWhat;
  210.   extern MenuId GetListId;
  211.   if (sysGetSendFilesV2(GetListId, Files, &sendWhat))
  212.     {
  213.     putSLNet(sendWhat, upfd);
  214.     AddedFiles = TRUE;
  215.  
  216.     }
  217.   return TRUE;
  218.  
  219.   }
  220. /*
  221. * addNetNode()
  222. *
  223. * This adds a node to the net listing.
  224. */
  225. void addNetNode()
  226.   {
  227.   int searcher, gen;
  228.   char  goodAnswer, found;
  229.   extern char *ALL_LOCALS;
  230.   MenuId id;
  231.   id = SysopContinual("", "", 2 * NAMESIZE, 5);
  232.   for (searcher = 0; searcher < cfg.netSize; searcher++)
  233.   if (netTab[searcher].ntflags.in_use == FALSE) break;
  234.   if (searcher != cfg.netSize)
  235.     {
  236.     getNet(searcher, &netBuf);
  237.     found = TRUE;
  238.     gen = (netBuf.nbGen + 1) % NET_GEN;
  239.  
  240.     }
  241.   else
  242.     {
  243.     found = FALSE;
  244.     gen = 0;
  245.  
  246.     }
  247.   killNetBuf(&netBuf);
  248.   zero_struct(netBuf);  /* Useful initialization       */
  249.   initNetBuf(&netBuf);
  250.   /* Get a unique name */
  251.   do
  252.     {
  253.     SysopContinualString(id, "SYSTEM", netBuf.netName, NAMESIZE, 0);
  254.     if (strLen(netBuf.netName) == 0)
  255.       {
  256.       SysopCloseContinual(id);
  257.       return;
  258.  
  259.       }
  260.     if ((goodAnswer = strCmpU(ALL_LOCALS, netBuf.netName)) == 0)
  261.     SysopError(id, "Sorry, reserved name\n ");
  262.     else if ((goodAnswer = searchNameNet(netBuf.netName, &netTemp)==ERROR) == 0)
  263.       {
  264.       sPrintf(msgBuf.mbtext, "Sorry, %s is already in use.\n ",
  265.       netBuf.netName);
  266.       SysopError(id, msgBuf.mbtext);
  267.  
  268.       }
  269.     else if (strchr(netBuf.netName, '_') != NULL)
  270.       {
  271.       goodAnswer = FALSE;
  272.       SysopError(id, "Please don't use '_' in the system name.\n ");
  273.  
  274.       }
  275.  
  276.     }
  277.   while (!goodAnswer);
  278.   /* Get a unique ID */
  279.   do
  280.     {
  281.     goodAnswer = TRUE;
  282.     SysopContinualString(id, "SYSTID", netBuf.netId, NAMESIZE, 0);
  283.     if (strLen(netBuf.netId) == 0)
  284.       {
  285.       SysopCloseContinual(id);
  286.       return;
  287.  
  288.       }
  289.     if (searchNet(netBuf.netId, &netTemp) != ERROR)
  290.       {
  291.       sPrintf(msgBuf.mbtext, "Sorry, %s is already in use.\n ",
  292.       netBuf.netId);
  293.       SysopError(id, msgBuf.mbtext);
  294.       goodAnswer = FALSE;
  295.  
  296.       }
  297.  
  298.     }
  299.   while (!goodAnswer);
  300.   netBuf.baudCode = (int) SysopGetNumber(id, "BAUDST", 0l, 8l);
  301.   netBuf.nbflags.local  = SysopGetYesNo(id, NULL, "ISSYSL");
  302.   netBuf.nbflags.in_use = TRUE;
  303.   netBuf.MemberNets   = 1;     /* Default */
  304.   netBuf.nbGen    = gen;   /* Update generation #  */
  305.   netBuf.nbRoute    = -1;
  306.   netBuf.nbflags.RouteTo  = TRUE;
  307.   netBuf.nbflags.RouteFor = TRUE;
  308.   if (!found)
  309.     {
  310.     if (cfg.netSize != 0)
  311.     netTab = (NetTable *)
  312.     realloc(netTab, sizeof (*netTab) * ++cfg.netSize);
  313.     else
  314.     netTab = (NetTable *)
  315.     GetDynamic(sizeof(*netTab) * ++cfg.netSize);
  316.     searcher = cfg.netSize - 1;
  317.     netTab[searcher].netTRooms = (SharedRoom *) GetDynamic(SR_BULK);
  318.  
  319.     }
  320.   putNet(searcher, &netBuf);
  321.   InitVNode(searcher);
  322.   DomainInit(FALSE);    /* so we can redirect easily enough */
  323.   SysopCloseContinual(id);
  324.  
  325.   }
  326. /*
  327. * addNetMem()
  328. *
  329. * This adds nets to this system's list.
  330. */
  331. int addNetMem(char *netnum)
  332.   {
  333.   int num;
  334.   MULTI_NET_DATA temp;
  335.   num = atoi(netnum);
  336.   if (num < 1 || num > MAX_NET - 1)
  337.     {
  338.     SysopError(NO_MENU, "There are only 31 nets to choose from.\n");
  339.     return TRUE;
  340.  
  341.     }
  342.   temp = 1l;
  343.   temp <<= (num-1);
  344.   netBuf.MemberNets |= temp;
  345.   return TRUE;
  346.  
  347.   }
  348. /*
  349. * subNetMem()
  350. *
  351. * This takes nets from a system's list.
  352. */
  353. int subNetMem(char *netnum)
  354.   {
  355.   int num;
  356.   MULTI_NET_DATA temp;
  357.   num = atoi(netnum);
  358.   if (num < 1 || num > MAX_NET - 1)
  359.     {
  360.     SysopError(NO_MENU, "There are only 31 nets to choose from.");
  361.     return TRUE;
  362.  
  363.     }
  364.   temp = 1l;
  365.   temp <<= (num-1);
  366.   temp = ~temp;
  367.   netBuf.MemberNets &= temp;
  368.   return TRUE;
  369.  
  370.   }
  371. /*
  372. * editNode()
  373. *
  374. * This function will edit a net node.
  375. */
  376. void editNode()
  377.   {
  378.   label  temp2;
  379.   char   title[50], work[50], temp[NAMESIZE*3];
  380.   int    place, compress;
  381.   MenuId id;
  382.   char   exttemp;
  383.   char   *NetEditOpts[] =
  384.     {
  385.     "A(ccess setting)  ", "B(aud code change)    ", "C(ondensed name)\n",
  386.     "D(ownload toggle) ", "E(xternal Dialer)     ", "F(ast Transfers)\n",
  387.     "I(D change)       ", "K(ill node from list) ", "L(ocal setting)\n",
  388.     "M(ember Nets)     ", "N(ame change)         ", "O(thernet toggle)\n",
  389.     "P(asswords)       ", "R(ooms shared)        ", "S(pine settings)\n",
  390.     "V(alues)          ", "X(Exit)\n",
  391.     #ifdef NEEDED
  392.     "ZKludge",
  393.     #endif
  394.     ""
  395.  
  396.     };
  397.   place = thisNet;    /* this is really a kludge, but for now will serve */
  398.   if (!NeedSysopInpPrompt())  /* rather icky, really.  fix someday? */
  399.   NodeValues(NO_MENU);
  400.   sPrintf(title, "\nEditing %s\n", netBuf.netName);
  401.   id = RegisterSysopMenu("netedit.mnu", NetEditOpts, title);
  402.   while (onLine())
  403.     {
  404.     outFlag = OUTOK;
  405.     sPrintf(work, "\n (%s) edit fn: ", netBuf.netName);
  406.     SysopMenuPrompt(id, work);
  407.     switch (GetSysopMenuChar(id))
  408.       {
  409.       case ERROR:
  410.       case 'X':
  411.       putNet(place, &netBuf);
  412.       CloseSysopMenu(id);
  413.       return;
  414.       case 'E':
  415.       exttemp = netBuf.nbflags.ExternalDialer;
  416.       if ((netBuf.nbflags.ExternalDialer =
  417.       SysopGetYesNo(id, NULL, "USEDIL")))
  418.         {
  419.         SysopRequestString(id, "DIALER",netBuf.access,sizeof netBuf.access,0);
  420.         }
  421.       else if (exttemp) /* clear old information */
  422.       netBuf.access[0] = 0;
  423.       break;
  424.       case 'A':
  425.       SysopRequestString(id, "ACCESS", netBuf.access,
  426.       sizeof netBuf.access, 0);
  427.       break;
  428.       case 'B':
  429.       netBuf.baudCode = (int) SysopGetNumber(id, "BAUDST", 0l, 8l);
  430.       break;
  431.       case 'C':
  432.       temp[0] = temp[1] = temp[2] = '\0';
  433.       SysopRequestString(id, "CONSNM", temp, 3, 0);
  434.       if (searchNameNet(temp, &netTemp) != ERROR)
  435.         {
  436.         sPrintf(work, "'%s' is already in use.", temp);
  437.         SysopError(id, work);
  438.  
  439.         }
  440.       else
  441.       strCpy(netBuf.nbShort, temp);
  442.       break;
  443.       case 'D':
  444.       sPrintf(work, "for %s %s.\n ",
  445.       netBuf.netName, netBuf.nbflags.NoDL ? "ON" : "OFF");
  446.       SysopInfoReport(id, work);
  447.       netBuf.nbflags.NoDL = !netBuf.nbflags.NoDL;
  448.       break;
  449.       case 'F':
  450.       netBuf.nbflags.MassTransfer = !netBuf.nbflags.MassTransfer;
  451.       if (netBuf.nbflags.MassTransfer)
  452.         {
  453.         /* kludges - next major release make into char */
  454.         netBuf.nbflags.Zoo = FALSE;
  455.         netBuf.nbflags.Zip = FALSE;
  456.         netBuf.nbflags.Lha = FALSE;
  457.         netBuf.nbflags.Arc = FALSE;
  458.         if ((compress = GetUserCompression()) == NO_COMP)
  459.           {
  460.           netBuf.nbflags.MassTransfer = FALSE;
  461.           RegisterThisMenu("netedit.mnu", NetEditOpts);
  462.           break;
  463.  
  464.           }
  465.         switch (compress)
  466.           {
  467.           case ZIP_COMP: netBuf.nbflags.Zip = TRUE;break;
  468.           case ZOO_COMP: netBuf.nbflags.Zoo = TRUE;break;
  469.           case ARC_COMP: netBuf.nbflags.Arc = TRUE;break;
  470.           case LHA_COMP: netBuf.nbflags.Lha = TRUE;break;
  471.  
  472.           }
  473.         RegisterThisMenu("netedit.mnu", NetEditOpts);
  474.  
  475.         }
  476.       sPrintf(work, "for %s %s.\n ", netBuf.netName,
  477.       netBuf.nbflags.MassTransfer ? "ON" : "OFF");
  478.       SysopInfoReport(id, work);
  479.       if (netBuf.nbflags.MassTransfer)
  480.         {
  481.         MakeNetCacheName(temp, thisNet);
  482.         mkdir(temp);
  483.  
  484.         }
  485.       putNet(thisNet, &netBuf);
  486.       /* more work here? */
  487.       break;
  488.       case 'R':
  489.       CloseSysopMenu(id);
  490.       EachSharedRoom(thisNet, DumpRoom, DumpVRoom, NULL);
  491.       if (onConsole) modIn();
  492.       sPrintf(title, " Editing %s ", netBuf.netName);
  493.       id = RegisterSysopMenu("netedit.mnu", NetEditOpts, title);
  494.       break;
  495.       case 'N':
  496.       SysopRequestString(id, "SYSTEM", temp, NAMESIZE, 0);
  497.       if (strLen(temp) != 0) strCpy(netBuf.netName, temp);
  498.       if (SysopGetYesNo(id, NULL, "NEWSYS"))
  499.         {
  500.         netBuf.nbGen = (netBuf.nbGen + 1) % NET_GEN;
  501.         KillTempFiles(thisNet);
  502.         ClearRoomSharing();
  503.  
  504.         }
  505.       break;
  506.       case 'I':
  507.       SysopRequestString(id, "SYSTID", temp, NAMESIZE, 0);
  508.       if (strLen(temp) != 0) strCpy(netBuf.netId, temp);
  509.       if (SysopGetYesNo(id, NULL, "NEWSYS"))
  510.         {
  511.         netBuf.nbGen = (netBuf.nbGen + 1) % NET_GEN;
  512.         KillTempFiles(thisNet);
  513.         ClearRoomSharing();
  514.  
  515.         }
  516.       break;
  517.       case 'K':
  518.       if (netBuf.nbflags.normal_mail)
  519.         {
  520.         sPrintf(work, "There is outgoing mail outstanding.\n ");
  521.         SysopInfoReport(id, work);
  522.  
  523.         }
  524.       if (netBuf.nbflags.room_files)
  525.         {
  526.         sPrintf(work, "There are file requests outstanding.\n ");
  527.         SysopInfoReport(id, work);
  528.  
  529.         }
  530.       if (SysopGetYesNo(id, NULL, "CONFRM"))
  531.         {
  532.         netBuf.nbflags.in_use = FALSE;
  533.         putNet(place, &netBuf);
  534.         KillTempFiles(thisNet);
  535.         KillCacheFiles(thisNet);
  536.         CloseSysopMenu(id);
  537.         return;
  538.  
  539.         }
  540.       break;
  541.       case 'L':
  542.       netBuf.nbflags.local = SysopGetYesNo(id, NULL, "ISSYSL");
  543.       break;
  544.       case 'P':
  545.       CloseSysopMenu(id);
  546.       Output_Citadel_Message("NTPSWO",
  547.                              (long)netBuf.OurPwd,
  548.                              (long)netBuf.TheirPwd, NULL);
  549.       if (getXString("NTNPWO", temp2, NAMESIZE, "", ""))
  550.       strCpy(netBuf.OurPwd, temp2);
  551.       if (getXString("NTNPWT", temp2, NAMESIZE, "", ""))
  552.       strCpy(netBuf.TheirPwd, temp2);
  553.       id = RegisterSysopMenu("netedit.mnu", NetEditOpts, title);
  554.       break;
  555.       case 'M':
  556.       getList(addNetMem, "Nets to add to this system's member list",
  557.       5, TRUE);
  558.       getList(subNetMem,"Nets to take off this system's member list",
  559.       5, TRUE);
  560.       break;
  561.       case 'S':
  562.       Output_Citadel_Message("ISPINE",(long)netBuf.netName,NULL,NULL);
  563.       if (!(netBuf.nbflags.spine = SysopGetYesNo(id, NULL, "CONFRM")))
  564.         {
  565.         Output_Citadel_Message("SPINEU",(long)netBuf.netName,NULL,NULL);
  566.         netBuf.nbflags.is_spine =
  567.         SysopGetYesNo(id, NULL, "CONFRM");
  568.  
  569.         }
  570.       else
  571.       netBuf.nbflags.is_spine = FALSE;
  572.       break;
  573.       case 'O':
  574.       Output_Citadel_Message((netBuf.nbflags.OtherNet) ? "NOTHER" : "OTHERN",NULL, NULL, NULL);
  575.       netBuf.nbflags.OtherNet = !netBuf.nbflags.OtherNet;
  576.       break;
  577.       case 'V':
  578.       NodeValues(id);
  579.       break;
  580.       #ifdef NEEDED
  581.       case 'Z':
  582.       netBuf.nbHiRouteInd = (int) getNumber("KLUDGE", 0l, 255l);
  583.       netBuf.nbflags.HasRouted = TRUE;
  584.       break;
  585.       #endif
  586.  
  587.       }
  588.  
  589.     }
  590.  
  591.   }
  592. /*
  593. * KillTempFiles()
  594. *
  595. * This eliminates unneeded temp files for dead node.
  596. */
  597. void KillTempFiles(int which)
  598.   {
  599.   label    temp;
  600.   SYS_FILE temp2;
  601.   sPrintf(temp, "%d.ml", which);
  602.   makeSysName(temp2, temp, &cfg.netArea);
  603.   unlink(temp2);
  604.   netBuf.nbflags.normal_mail = FALSE;
  605.   sPrintf(temp, "%d.rfl", which);
  606.   makeSysName(temp2, temp, &cfg.netArea);
  607.   unlink(temp2);
  608.   netBuf.nbflags.room_files = FALSE;
  609.   sPrintf(temp, "%d.sfl", which);
  610.   makeSysName(temp2, temp, &cfg.netArea);
  611.   unlink(temp2);
  612.   netBuf.nbflags.send_files = FALSE;
  613.   sPrintf(temp, "%d.vtx", which);
  614.   makeSysName(temp2, temp, &cfg.netArea);
  615.   unlink(temp2);
  616.   InitVNode(thisNet);
  617.  
  618.   }
  619. /*
  620. * ClearRoomSharing()
  621. *
  622. * This clears room sharing out completely for this node.
  623. */
  624. void ClearRoomSharing()
  625.   {
  626.   int i;
  627.   for (i = 0; i < SHARED_ROOMS; i++)
  628.   netBuf.netRooms[i].srgen = 0;
  629.  
  630.   }
  631. /*
  632. * NodeValues()
  633. *
  634. * This function prints out the values for the current node.
  635. */
  636. void NodeValues(MenuId id)
  637.   {
  638.   int i, first;
  639.   MULTI_NET_DATA h;
  640.   sPrintf(msgBuf.mbtext, "\n Node #%d: %s", thisNet, netBuf.netName);
  641.   if (strLen(netBuf.nbShort))
  642.   sPrintf(lbyte(msgBuf.mbtext), " (%s)", netBuf.nbShort);
  643.   sPrintf(lbyte(msgBuf.mbtext), "\n Id: %s (%slocal @ %s)\n ",
  644.   netBuf.netId,
  645.   netBuf.nbflags.local ? "" : "non",
  646.   SupportedBauds[netBuf.baudCode]);
  647.   if (netBuf.nbflags.ExternalDialer)
  648.   sPrintf(lbyte(msgBuf.mbtext), "External Dialer Information: %s\n ", netBuf.access);
  649.   if (strLen(netBuf.access) != 0 && !netBuf.nbflags.ExternalDialer)
  650.   sPrintf(lbyte(msgBuf.mbtext), "Access: %s\n ", netBuf.access);
  651.   if (netBuf.nbflags.spine)
  652.   sPrintf(lbyte(msgBuf.mbtext), "We are a spine for this system\n ");
  653.   else if (netBuf.nbflags.is_spine)
  654.   sPrintf(lbyte(msgBuf.mbtext), "This system is a spine\n ");
  655.   if (netBuf.nbflags.OtherNet)
  656.   sPrintf(lbyte(msgBuf.mbtext), "This system is designated as OtherNet.\n ");
  657.   if (netBuf.nbflags.normal_mail)
  658.   sPrintf(lbyte(msgBuf.mbtext), "There is outgoing Mail>.\n ");
  659.   if (netBuf.nbflags.HasRouted)
  660.   sPrintf(lbyte(msgBuf.mbtext), "There is outgoing RouteMail.\n ");
  661.   if (DomainFlags[thisNet])
  662.   sPrintf(lbyte(msgBuf.mbtext), "There is outgoing DomainMail.\n ");
  663.   if (netBuf.nbflags.room_files)
  664.   sPrintf(lbyte(msgBuf.mbtext), "There are file requests outstanding.\n ");
  665.   if (netBuf.nbflags.send_files)
  666.   sPrintf(lbyte(msgBuf.mbtext), "There are files to be sent.\n ");
  667.   if (netBuf.nbflags.MassTransfer)
  668.   sPrintf(lbyte(msgBuf.mbtext), "Fast Transfers on (using %s).\n ",
  669.   GetCompEnglish(GetCompression(thisNet)));
  670.   if (netBuf.MemberNets != 0l)
  671.     {
  672.     sPrintf(lbyte(msgBuf.mbtext), "This system is assigned to the following nets: ");
  673.     for (i = 0, first = 1, h = 1l; i < MAX_NET; i++)
  674.       {
  675.       if (h & netBuf.MemberNets)
  676.         {
  677.         if (!first)
  678.         sPrintf(lbyte(msgBuf.mbtext), ", ");
  679.         else first = FALSE;
  680.         sPrintf(lbyte(msgBuf.mbtext), "%d", i+1); /* Yes - +1. Number the bits starting with 1 */
  681.  
  682.         }
  683.       h <<= 1;
  684.  
  685.       }
  686.     sPrintf(lbyte(msgBuf.mbtext), ".\n ");
  687.  
  688.     }
  689.   else sPrintf(lbyte(msgBuf.mbtext), "This system is currently disabled.\n ");
  690.   sPrintf(lbyte(msgBuf.mbtext), "Last connected: %s\n", AbsToReadable(netBuf.nbLastConnect));
  691.   SysopDisplayInfo(id, msgBuf.mbtext, " Values ");
  692.  
  693.   }
  694.  
  695. void fileRequest()
  696.   {
  697.   /**
  698.    Description:
  699.    This handles the administration of requesting files from another system.
  700.   **/
  701.   struct fl_req file_data;
  702.   label    data;
  703.   char     loc[100], *c, *work;
  704.   SYS_FILE fn;
  705.   char     abort;
  706.   FILE     *temp;
  707.   int      place;
  708.   extern char *APPEND_ANY;
  709.   char     ambiguous, again;
  710.  
  711.   place = thisNet;    /* again, a kludge to be killed later */
  712.   Request_String("Enter Room Name:", file_data.room, NAMESIZE);
  713.   if (strLen(file_data.room) == 0)    return;
  714.  
  715.   Request_String("Enter the filename:", loc, sizeof loc);
  716.   if (strLen(loc) == 0)    return;
  717.  
  718.   ambiguous = !(strchr(loc, '*') == NULL
  719.              && strchr(loc, '?') == NULL
  720.              && strchr(loc, ' ') == NULL);
  721.  
  722.   abort = !netGetAreaV2(id, loc, &file_data, ambiguous);
  723.   if ( !abort )
  724.     {
  725.     sPrintf(data, "%d.rfl", place);
  726.     makeSysName(fn, data, &cfg.netArea);
  727.     if ((temp = safeopen(fn, APPEND_ANY)) == NULL)
  728.       {
  729.       printf("Couldn't open %s for append\n", fn);
  730.       }
  731.     else
  732.       {
  733.       work = loc;
  734.       do
  735.         {
  736.         again = (c = strchr(work, ' ')) != NULL;
  737.         if ( again ) *c = 0;
  738.         strCpy(file_data.roomfile, work);
  739.         if (ambiguous) strCpy(file_data.filename, work);
  740.         fwrite(&file_data, sizeof (file_data), 1, temp);
  741.         if (again) work = c + 1;
  742.         }   while ( again );
  743.       netBuf.nbflags.room_files = TRUE;
  744.       putNet(place, &netBuf);
  745.       fclose(temp);
  746.  
  747.       };
  748.     };
  749.   }
  750.  
  751.  
  752. void ExplainNeed(int i, MULTI_NET_DATA x)
  753.   {
  754.   char c0,c1,c2;
  755.   if (!cfg.BoolFlags.debug) return;
  756.   c0 = netTab[i].ntShort[0];
  757.   if( !isprint(c0))c0 = ' ';
  758.   c1 = netTab[i].ntShort[1];
  759.   c2 = netTab[i].ntShort[2];
  760.   if( !isprint(c0))c0 = ' ';
  761.   if( !isprint(c1))c1 = ' ';
  762.   if( !isprint(c2))c2 = ' ';
  763.   splitF(netLog," Networking with:( %c%c%c ) \n",c0,c1,c2);
  764.   splitF(netLog, "slot %d%sin use is%sspine we are%sa spine \n",
  765.   i, netTab[i].ntflags.in_use      ? " ":" not ",
  766.   netTab[i].ntflags.is_spine       ? " ":" not ",
  767.   netTab[i].ntflags.spine          ? " ":" not ");
  768.   splitF(netLog, " MN%ld has%smail\n",  netTab[i].ntMemberNets & x,
  769.   netTab[i].ntflags.normal_mail ? " ":" no ");
  770.   splitF(netLog, "%sfile requests %ssend requests has%srooms to share\n",
  771.   netTab[i].ntflags.room_files ? " ":" no ",
  772.   netTab[i].ntflags.send_files ? " ":" no ",
  773.   roomsShared(i) ? " ":" no ");
  774.   splitF(netLog, " Domain Flags:%d has%srouted for %s mode \n",
  775.   DomainFlags[i],
  776.   netTab[i].ntflags.HasRouted ? " ":" no ",
  777.   (inNet == NON_NET)    ? "NON_NET":
  778.   (inNet == NORMAL_NET) ? "NORMAL_NET" :
  779.   (inNet == ANYTIME_NET)? "ANYTIME_NET" :
  780.   (inNet == UNTIL_NET)  ? "UNTIL_NET": "UNKNOWN");
  781.  
  782.   }
  783.  
  784. void writeNet(char LocalOnly)
  785.   {
  786.   /**
  787.   Description:
  788.   This function writes nodes on the net to the screen.  Options include
  789.   showing only local systems and with or without their ids.
  790.   **/
  791.   int rover;
  792.   int i;
  793.   printf("     %20s %22s TF Member Nets\n", "Systems", "Node Id");
  794.   for (rover = 0; rover < cfg.netSize; rover++)
  795.     {
  796.     if (netTab[rover].ntflags.in_use
  797.     && (!LocalOnly || netTab[rover].ntflags.local))
  798.       {
  799.       getNet(rover, &netBuf);
  800.       printf("%3s%-20s %-22s "
  801.       (strLen(netBuf.nbShort) != 0) ? &netBuf.nbShort : "   ",
  802.       , netBuf.netName, netBuf.netId );
  803.       printf("%-8s",SupportedBauds[netBuf.baudCode]);
  804.       if (netBuf.nbflags.OtherNet)
  805.         printf("O");
  806.       else if (!(netBuf.MemberNets & ALL_NETS))
  807.         printf("d");
  808.       else printf(" ");
  809.       printf("%c ".(netBuf.nbflags.MassTransfer) ? 'F' : ' ');
  810.       for (i = 0; i < 32; i++)
  811.         {
  812.         if ((1l << i) & netBuf.MemberNets) printf("%d ", i + 1);
  813.         };
  814.        };
  815.     };
  816.   }
  817.